package by.grsu.bso.persistence.impl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

import by.grsu.bso.model.OrderItem;
import by.grsu.bso.persistence.base.IOrderItemDAO;
import by.grsu.bso.persistence.util.DaoManager;

public class OrderItemDAO extends DaoManager implements IOrderItemDAO {

	private static final String CREATE_ORDER_ITEM = "INSERT INTO shopdb.OrderItem(OrderID, ProductID, Quantity) VALUES(?, ?, ?);";
	
	@Override
	public List<OrderItem> get() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public OrderItem findById(int id) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<OrderItem> findAll() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<OrderItem> findByExample(OrderItem exampleInstance) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int countAll() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int countByExample(OrderItem exampleInstance) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public OrderItem save(OrderItem entity) throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void delete(int id) throws SQLException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public OrderItem create() throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void createOrderItem(OrderItem entity) throws SQLException {
		Connection conn = getConnection();

		PreparedStatement stmt = conn.prepareStatement(OrderItemDAO.CREATE_ORDER_ITEM);
		stmt.setInt(1, entity.getOrderId());
		stmt.setInt(2, entity.getProductId());
		stmt.setInt(3, entity.getQuantity());
		stmt.executeUpdate();

		closeConnection(conn, null, stmt);
		
	}

}
